<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var int=setInterval("clock()",1000);
        var  num=10;
        function  clock() {
            num>0 ? num-- :location.href='http://www.baidu.com';
            document.getElementById("time1").innerHTML=num;
        }
        /* var num=10;
         var int =setInterval("time()",1000);
         function time() {
              for(;num>=0;num--){
                  if(num==0){
                      location.href='http://www.baidu.com';
                  }else
                  document.getElementById("time1").innerHTML=num;
              }
         }*/

    </script>
</head>
<body>
<h1 id="time1"></h1>
</body>
</html>